SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Usuario](
	[IdUsuario] [varchar](50) NOT NULL,
	[Nombre] [varchar](50) NOT NULL,
	[Telefono] [varchar](50) NOT NULL,
	[Email] [varchar](128) NOT NULL,
	[Password] [varchar](50) NOT NULL,
	[Pregunta] [varchar](256) NOT NULL,
	[Respuesta] [varchar](256) NOT NULL,
	[CantidadEnviosMail] [int] NOT NULL,
	[FechaUltimoReenvioMail] [datetime] NOT NULL,
	[EmailSMS] [varchar](50) NOT NULL,
	[IdMedio] [varchar](15) NOT NULL,
	[IdWF] [int] NOT NULL,
	[Estado] [varchar](15) NOT NULL,
	[UltActualiz] [timestamp] NOT NULL,
 CONSTRAINT [PK_Table_Usuario] PRIMARY KEY CLUSTERED 
(
	[IdUsuario] ASC
)WITH (PAD_INDEX  = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO


SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Medio](
	[IdMedio] [varchar](15) NOT NULL,
	[DescrMedio] [varchar](50) NOT NULL,
 CONSTRAINT [PK_Table_Medio] PRIMARY KEY CLUSTERED 
(
	[IdMedio] ASC
)WITH (PAD_INDEX  = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO

insert Medio values ('', '')
insert Medio values ('Internet', 'Internet')
insert Medio values ('Recommendation', 'Recommendation')
insert Medio values ('Mail', 'Mail')
insert Medio values ('Other', 'Other')


SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Milonga](
	[IdMilonga] [int] NOT NULL,
	[IdUsuario] [varchar](50) NOT NULL,
	[Nombre] [varchar](50) NOT NULL,
	[Descripcion] [varchar](250) NOT NULL,
	[Pais] [varchar](50) NOT NULL,
	[Provincia] [varchar](50) NOT NULL,
	[Localidad] [varchar](50) NOT NULL,
	[Direccion] [varchar](60) NOT NULL,
	[CodPost] [varchar](10) NOT NULL,
	[Telefono] [varchar](30) NOT NULL,   
	[MonedaEntrada] [varchar](10) NOT NULL,   
	[PrecioEntrada] [numeric](18, 2) NOT NULL,
	[ComentarioPrecioEntrada] [varchar](250) NOT NULL,
	[Email] [varchar](60) NOT NULL,
	[WebSite] [varchar](100) NOT NULL,
	[Comentarios] [varchar](250) NOT NULL,
	[NombreContacto] [varchar](25) NOT NULL,
	[EmailContacto] [varchar](60) NOT NULL,
	[TelefonoContacto] [varchar](50) NOT NULL,
	[IdWF] [int] NOT NULL,
	[Estado] [varchar](15) NOT NULL,
	[Facebook] [varchar](100) NOT NULL,
	[TipoPiso] [varchar](15) NOT NULL,
	[TipoMilonga] [varchar](15) NOT NULL,
	[TipoMusica] [varchar](15) NOT NULL,
	[GoogleMap] [varchar](100) NOT NULL,
	[Ranking] [int] NOT NULL,
	[UltActualiz] [timestamp] NOT NULL,
 CONSTRAINT [PK_Table_Milonga] PRIMARY KEY CLUSTERED 
(
	[IdMilonga] ASC
)WITH (PAD_INDEX  = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO


SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[TipoPermiso](
	[IdTipoPermiso] [varchar](30) NOT NULL,
	[DescrTipoPermiso] [varchar](50) NOT NULL,
 CONSTRAINT [PK_Table_TipoPermiso] PRIMARY KEY CLUSTERED 
(
	[IdTipoPermiso] ASC
)WITH (PAD_INDEX  = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO

insert TipoPermiso values ('AdminSITE', 'Administrator Site')
insert TipoPermiso values ('OperMilonga', 'Operator Milonga')


SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Permiso](
	[IdUsuario] [varchar](50) NOT NULL,
	[IdTipoPermiso] [varchar](30) NOT NULL,
	[FechaFinVigencia] [datetime] NOT NULL,
	[IdWF] [int] NOT NULL,
	[Estado] [varchar](15) NOT NULL,
 CONSTRAINT [PK_Table_Permiso] PRIMARY KEY CLUSTERED 
(
	[IdUsuario] ASC,
	[IdTipoPermiso] ASC
)WITH (PAD_INDEX  = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
ALTER TABLE [dbo].[Permiso]  WITH CHECK ADD  CONSTRAINT [FK_Permiso_TipoPermiso] FOREIGN KEY([IdTipoPermiso])
REFERENCES [dbo].[TipoPermiso] ([IdTipoPermiso])
GO
ALTER TABLE [dbo].[Permiso] CHECK CONSTRAINT [FK_Permiso_TipoPermiso]
GO


SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Configuracion](
	[IdUsuario] [varchar](50) NOT NULL,
	[IdTipoPermiso] [varchar](30) NOT NULL,
	[IdItemConfig] [varchar](50) NOT NULL,
	[Valor] [varchar](256) NOT NULL,
 CONSTRAINT [PK_Table_Configuracion] PRIMARY KEY CLUSTERED 
(
	[IdUsuario] ASC,
	[IdTipoPermiso] ASC,
	[IdItemConfig] ASC
)WITH (PAD_INDEX  = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO

insert Configuracion values ('', '', 'UltimoIdWF', '0')
insert Configuracion values ('', 'OperMilonga', 'UltimoIdMilonga', '0')


SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Log](
	[IdLog] [int] IDENTITY(1,1) NOT NULL,
	[IdWF] [int] NOT NULL,
	[Fecha] [datetime] NOT NULL,
	[IdUsuario] [varchar](50) NOT NULL,
	[Entidad] [varchar](30) NOT NULL,
	[Evento] [varchar](30) NOT NULL,
	[Estado] [varchar](15) NOT NULL,
	[Comentario] [varchar](256) NOT NULL,
 CONSTRAINT [PK_Table_Log] PRIMARY KEY CLUSTERED 
(
	[IdLog] ASC
)WITH (PAD_INDEX  = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO

SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[LogDetalle](
	[IdLogDetalle] [int] IDENTITY(1,1) NOT NULL,
	[IdLog] [int] NOT NULL,
	[TipoDetalle] [varchar](50) NOT NULL,
	[Detalle] [text] NOT NULL,
 CONSTRAINT [PK_Table_LogDetalle] PRIMARY KEY CLUSTERED 
(
	[IdLogDetalle] ASC
)WITH (PAD_INDEX  = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
ALTER TABLE [dbo].[LogDetalle]  WITH CHECK ADD  CONSTRAINT [FK_LogDetalle_Log] FOREIGN KEY([IdLog])
REFERENCES [dbo].[Log] ([IdLog])
GO
ALTER TABLE [dbo].[LogDetalle] CHECK CONSTRAINT [FK_LogDetalle_Log]
GO

SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Horario](
	[IdMilonga] [int] NOT NULL,
	[CodigoDiaSemDesde] [int] NOT NULL,
	[CodigoDiaSemHasta] [int] NOT NULL,
	[HorarioDesde] [varchar](5) NOT NULL,
	[HorarioHasta] [varchar](5) NOT NULL,
	[Comentario] [varchar](250) NOT NULL,
	[Activo] [bit] NOT NULL,
CONSTRAINT [PK_Table_Horario] PRIMARY KEY CLUSTERED 
(
	[IdMilonga] ASC,
	[CodigoDiaSemDesde] ASC,
	[CodigoDiaSemHasta] ASC,
	[HorarioDesde] ASC
)WITH (PAD_INDEX  = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO

declare @idWF varchar(256)
update Configuracion set @idWF=Valor=convert(varchar(256), convert(int, Valor)+1) where IdItemConfig='UltimoIdWF'
insert Usuario (IdUsuario, Nombre, Telefono, Email, Password, Pregunta, Respuesta, CantidadEnviosMail, FechaUltimoReenvioMail, EmailSMS, IdMedio, IdWF, Estado) values ('administrador', 'Usuario administardor del sitio', '', 'pjeconde@yahoo.com.ar', '123456', 'Cual es mi equipo de futbol', 'boca', 0, getdate(), 'pjeconde@yahoo.com.ar', '', @IdWF, 'Active')
insert Log values (@IdWF, getdate(), 'administrador', 'Usuario', 'New', 'Active', 'New Script')
update Configuracion set @idWF=Valor=convert(varchar(256), convert(int, Valor)+1) where IdItemConfig='UltimoIdWF'
insert Permiso values ('administrador', 'AdminSITE', '20621231', @idWF, 'Active')
insert Log values (@IdWF, getdate(), 'administrador', 'Permiso', 'New', 'Active', 'New Script')
update Configuracion set @idWF=Valor=convert(varchar(256), convert(int, Valor)+1) where IdItemConfig='UltimoIdWF'
insert Permiso values ('administrador', 'OperMilonga', '20621231', @idWF, 'Active')
insert Log values (@IdWF, getdate(), 'administrador', 'Permiso', 'New', 'Active', 'New Script')

alter table Milonga add TipoDestacado varchar(2) not null default('')


SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE dbo.Comentario (
	IdComentario int NOT NULL,
	IdReplica int NOT NULL, 
	NombreEntidad varchar(50) NOT NULL,
	IdEntidad int NOT NULL,
	NombreUsuario varchar(50) NOT NULL,
	IdUsuario varchar(50) NOT NULL,
	Contenido ntext NOT NULL,
	Fecha datetime NOT NULL,
	Url nvarchar(200) NOT NULL,
	Estado varchar(15) NOT NULL, 
	ManoOk int NOT NULL, 
	ManoNoOk int NOT NULL, 
	AbusoContenido int NOT NULL, 
CONSTRAINT PK_Table_Comentario PRIMARY KEY CLUSTERED 
(
	NombreEntidad ASC, 
	IdEntidad ASC,
	IdComentario ASC, 
	IdReplica ASC 
)WITH (PAD_INDEX  = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO


SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE dbo.ComentarioEstadistica (
	NombreEntidad varchar(50) NOT NULL,
	IdEntidad int NOT NULL,
	IdComentario int NOT NULL,
	IdReplica int NOT NULL, 
	IdUsuario varchar(50) NOT NULL,
	Objeto varchar(30) NOT NULL,
CONSTRAINT PK_Table_ComentarioEstadistica PRIMARY KEY CLUSTERED 
(
	NombreEntidad ASC,
	IdEntidad ASC,
	IdComentario ASC, 
	IdReplica ASC,
	IdUsuario ASC, 
	Objeto ASC
)WITH (PAD_INDEX  = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO


SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Festival](
	[IdFestival] [int] NOT NULL,
	[IdUsuario] [varchar](50) NOT NULL,
	[Nombre] [varchar](50) NOT NULL,
	[Descripcion] [varchar](250) NOT NULL,
	[Pais] [varchar](50) NOT NULL,
	[Provincia] [varchar](50) NOT NULL,
	[Localidad] [varchar](50) NOT NULL,
	[Direccion] [varchar](60) NOT NULL,
	[CodPost] [varchar](10) NOT NULL,
	[Telefono] [varchar](30) NOT NULL,   
	[MonedaEntrada] [varchar](10) NOT NULL,   
	[PrecioEntrada] [numeric](18, 2) NOT NULL,
	[ComentarioPrecioEntrada] [varchar](250) NOT NULL,
	[Email] [varchar](60) NOT NULL,
	[WebSite] [varchar](100) NOT NULL,
	[Comentarios] [varchar](250) NOT NULL,
	[NombreContacto] [varchar](25) NOT NULL,
	[EmailContacto] [varchar](60) NOT NULL,
	[TelefonoContacto] [varchar](50) NOT NULL,
	[IdWF] [int] NOT NULL,
	[Estado] [varchar](15) NOT NULL,
	[Facebook] [varchar](100) NOT NULL,
	[GoogleMap] [varchar](100) NOT NULL,
	[Bailarines] [varchar](250) NOT NULL,
	[FechaDesde] [DateTime] NOT NULL,
	[FechaHasta] [DateTime] NOT NULL,
	[Ranking] [int] NOT NULL,
	[UltActualiz] [timestamp] NOT NULL,
	[TipoDestacado] varchar(2) NOT NULL,
 CONSTRAINT [PK_Table_Festival] PRIMARY KEY CLUSTERED 
(
	[IdFestival] ASC
)WITH (PAD_INDEX  = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO

insert Configuracion values ('', 'OperFestival', 'UltimoIdFestival', '0')
go

insert TipoPermiso values ('OperFestival', 'Operator Festival')
go

declare @idWF varchar(256)
update Configuracion set @idWF=Valor=convert(varchar(256), convert(int, Valor)+1) where IdItemConfig='UltimoIdWF'
insert Permiso values ('administrador', 'OperFestival', '20621231', @idWF, 'Active')
insert Log values (@IdWF, getdate(), 'administrador', 'Permiso', 'New', 'Active', 'New Script')


SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[HorarioFecha](
	[NombreEntidad] [varchar](50) NOT NULL,
	[IdEntidad] [int] NOT NULL,
	[FechaDesde] [DateTime] NOT NULL,
	[FechaHasta] [DateTime] NOT NULL,
	[CodigoDiaSemDesde] [int] NOT NULL,
	[CodigoDiaSemHasta] [int] NOT NULL,
	[HorarioDesde] [varchar](5) NOT NULL,
	[HorarioHasta] [varchar](5) NOT NULL,
	[Comentario] [varchar](250) NOT NULL,
	[Activo] [bit] NOT NULL,
CONSTRAINT [PK_Table_HorarioFecha] PRIMARY KEY CLUSTERED 
(
	[NombreEntidad] ASC,
	[IdEntidad] ASC,
	[FechaDesde] ASC,
	[FechaHasta] ASC,
	[CodigoDiaSemDesde] ASC,
	[CodigoDiaSemHasta] ASC,
	[HorarioDesde] ASC
)WITH (PAD_INDEX  = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO


SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Profesor](
	[IdProfesor] [int] NOT NULL,
	[IdUsuario] [varchar](50) NOT NULL,
	[Nombre] [varchar](50) NOT NULL,
	[Descripcion] [varchar](250) NOT NULL,
	[Pais] [varchar](50) NOT NULL,
	[Provincia] [varchar](50) NOT NULL,
	[Localidad] [varchar](50) NOT NULL,
	[Direccion] [varchar](60) NOT NULL,
	[CodPost] [varchar](10) NOT NULL,
	[Telefono] [varchar](30) NOT NULL,   
	[Email] [varchar](60) NOT NULL,
	[WebSite] [varchar](100) NOT NULL,
	[Estilo] [varchar](20) NOT NULL,
	[IdWF] [int] NOT NULL,
	[Estado] [varchar](15) NOT NULL,
	[Facebook] [varchar](100) NOT NULL,
	[YouTube] [varchar](100) NOT NULL,
	[Ranking] [int] NOT NULL,
	[UltActualiz] [timestamp] NOT NULL,
	[TipoDestacado] varchar(2) NOT NULL,
	[TipoProfesor] varchar(15) NOT NULL,
 CONSTRAINT [PK_Table_Profesor] PRIMARY KEY CLUSTERED 
(
	[IdProfesor] ASC
)WITH (PAD_INDEX  = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO

insert Configuracion values ('', 'OperTeacher', 'UltimoIdProfesor', '0')
go

insert TipoPermiso values ('OperTeacher', 'Operator Teacher or Taxi Dancer')
go

declare @idWF varchar(256)
update Configuracion set @idWF=Valor=convert(varchar(256), convert(int, Valor)+1) where IdItemConfig='UltimoIdWF'
insert Permiso values ('administrador', 'OperTeacher', '20621231', @idWF, 'Active')
insert Log values (@IdWF, getdate(), 'administrador', 'Permiso', 'New', 'Active', 'New Script')


SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Alojamiento](
	[IdAlojamiento] [int] NOT NULL,
	[IdUsuario] [varchar](50) NOT NULL,
	[Descripcion] [varchar](250) NOT NULL,
	[Pais] [varchar](50) NOT NULL,
	[Provincia] [varchar](50) NOT NULL,
	[Localidad] [varchar](50) NOT NULL,
	[Direccion] [varchar](60) NOT NULL,
	[CodPost] [varchar](10) NOT NULL,
	[NombreContacto] [varchar](25) NOT NULL,
	[EmailContacto] [varchar](60) NOT NULL,
	[TelefonoContacto] [varchar](50) NOT NULL,
	[Comentarios] [varchar](250) NOT NULL,
	[GoogleMap] [varchar](100) NOT NULL,
	[IdWF] [int] NOT NULL,
	[Estado] [varchar](15) NOT NULL,
	[Ranking] [int] NOT NULL,
	[UltActualiz] [timestamp] NOT NULL,
	[TipoDestacado] varchar(2) NOT NULL,
 CONSTRAINT [PK_Table_Alojamiento] PRIMARY KEY CLUSTERED 
(
	[IdAlojamiento] ASC
)WITH (PAD_INDEX  = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO

insert Configuracion values ('', 'OperHost', 'UltimoIdAlojamiento', '0')
go

insert TipoPermiso values ('OperHost', 'Operator Host')
go

declare @idWF varchar(256)
update Configuracion set @idWF=Valor=convert(varchar(256), convert(int, Valor)+1) where IdItemConfig='UltimoIdWF'
insert Permiso values ('administrador', 'OperHost', '20621231', @idWF, 'Active')
insert Log values (@IdWF, getdate(), 'administrador', 'Permiso', 'New', 'Active', 'New Script')



SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Publicidad](
	[IdCatalogo] [varchar](50) NOT NULL,
	[IdPublicidad] [int] NOT NULL,
	[IdUsuario] [varchar](50) NOT NULL,
	[ImageUrl] [varchar](250) NOT NULL,
	[NavigateUrl] [varchar](250) NOT NULL,
	[AlternateText] [varchar](250) NOT NULL,
	[Impression] [varchar](250) NOT NULL,
	[Keyword] [varchar](250) NOT NULL,
	[Estado] [varchar](15) NOT NULL,
CONSTRAINT [PK_Table_Publicidad] PRIMARY KEY CLUSTERED 
(
	[IdCatalogo] ASC,
	[IdPublicidad]
)WITH (PAD_INDEX  = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO

insert Configuracion values ('', '', 'UltimoIdPublicidad', '0')
GO


SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[CastingArtistsOffer](
	[IdCastingArtistsOffer] [int] NOT NULL,
	[IdUsuario] [varchar](50) NOT NULL,
	[Nombre] [varchar](50) NOT NULL,
	[Descripcion] [varchar](250) NOT NULL,
	[Pais] [varchar](50) NOT NULL,
	[Provincia] [varchar](50) NOT NULL,
	[Localidad] [varchar](50) NOT NULL,
	[Telefono] [varchar](30) NOT NULL,   
	[Email] [varchar](60) NOT NULL,
	[WebSite] [varchar](100) NOT NULL,
	[Estilo] [varchar](20) NOT NULL,
	[IdWF] [int] NOT NULL,
	[Estado] [varchar](15) NOT NULL,
	[Facebook] [varchar](100) NOT NULL,
	[YouTube] [varchar](100) NOT NULL,
	[Ranking] [int] NOT NULL,
	[UltActualiz] [timestamp] NOT NULL,
	[TipoDestacado] varchar(2) NOT NULL,
 CONSTRAINT [PK_Table_CastingArtistsOffer] PRIMARY KEY CLUSTERED 
(
	[IdCastingArtistsOffer] ASC
)WITH (PAD_INDEX  = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO

insert Configuracion values ('', 'OperCastingArtistsOffer', 'UltimoIdCastingArtistsOffer', '0')
go

insert TipoPermiso values ('OperCastingArtistsOffer', 'Operator Calling Artists Offer')
go

declare @idWF varchar(256)
update Configuracion set @idWF=Valor=convert(varchar(256), convert(int, Valor)+1) where IdItemConfig='UltimoIdWF'
insert Permiso values ('administrador', 'OperCastingArtistsOffer', '20621231', @idWF, 'Active')
insert Log values (@IdWF, getdate(), 'administrador', 'Permiso', 'New', 'Active', 'New Script')



SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[CastingArtistsCall](
	[IdCastingArtistsCall] [int] NOT NULL,
	[IdUsuario] [varchar](50) NOT NULL,
	[Nombre] [varchar](50) NOT NULL,
	[Descripcion] [varchar](250) NOT NULL,
	[Pais] [varchar](50) NOT NULL,
	[Provincia] [varchar](50) NOT NULL,
	[Localidad] [varchar](50) NOT NULL,
	[Telefono] [varchar](30) NOT NULL,   
	[Email] [varchar](60) NOT NULL,
	[WebSite] [varchar](100) NOT NULL,
	[Estilo] [varchar](20) NOT NULL,
	[IdWF] [int] NOT NULL,
	[Estado] [varchar](15) NOT NULL,
	[Facebook] [varchar](100) NOT NULL,
	[Ranking] [int] NOT NULL,
	[UltActualiz] [timestamp] NOT NULL,
	[TipoDestacado] varchar(2) NOT NULL,
 CONSTRAINT [PK_Table_CastingArtistsCall] PRIMARY KEY CLUSTERED 
(
	[IdCastingArtistsCall] ASC
)WITH (PAD_INDEX  = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO

insert Configuracion values ('', 'OperCastingCall', 'UltimoIdCastingCall', '0')
go

insert TipoPermiso values ('OperCastingCall', 'Operator Casting Call')
go

declare @idWF varchar(256)
update Configuracion set @idWF=Valor=convert(varchar(256), convert(int, Valor)+1) where IdItemConfig='UltimoIdWF'
insert Permiso values ('administrador', 'OperCastingCall', '20621231', @idWF, 'Active')
insert Log values (@IdWF, getdate(), 'administrador', 'Permiso', 'New', 'Active', 'New Script')


alter table dbo.CastingArtistsCall alter column Estilo varchar(250) not null
alter table dbo.CastingArtistsOffer alter column Estilo varchar(250) not null

alter table usuario add Pais varchar(50) not null default ''
alter table usuario add Provincia varchar(50) not null default ''
alter table usuario add Localidad varchar(50) not null default ''
alter table usuario add Direccion varchar(60) not null default ''
alter table usuario add CodPost varchar(10) not null default ''
alter table usuario add Facebook varchar(100) not null default ''
alter table usuario add DatoAdicional1 varchar(250) not null default ''
alter table usuario add DatoAdicional2 varchar(250) not null default ''



SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[AirTicket](
	[IdAirTicket] [int] NOT NULL,
	[IdUsuario] [varchar](50) NOT NULL,
	[Nombre] [varchar](50) NOT NULL,
	[Email] [varchar](60) NOT NULL,
	[Telefono] [varchar](50) NOT NULL,   
	[idaYVuelta] [bit] NOT NULL,   
	[PaisOrigen] [varchar](50) NOT NULL,
	[ProvinciaOrigen] [varchar](50) NOT NULL,
	[LocalidadOrigen] [varchar](50) NOT NULL,
	[PaisDestino] [varchar](50) NOT NULL,
	[ProvinciaDestino] [varchar](50) NOT NULL,
	[LocalidadDestino] [varchar](50) NOT NULL,
	[FechaDesde] [datetime] NOT NULL,
	[FechaHasta] [datetime] NOT NULL,
	[Clase] [varchar](30) NOT NULL,
	[CantidadPersonasAdult] [int] NOT NULL,
	[CantidadPersonasChild] [int] NOT NULL,
	[Descripcion] [varchar](250) NOT NULL,
	[FechaAlta] [datetime] NOT NULL,
	[IdWF] [int] NOT NULL,
	[Estado] [varchar](15) NOT NULL,
 CONSTRAINT [PK_Table_AirTicket] PRIMARY KEY CLUSTERED 
(
	[IdAirTicket] ASC
)WITH (PAD_INDEX  = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO

insert Configuracion values ('', '', 'UltimoIdAirTicket', '0')
GO


SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Housing](
	[IdHousing] [int] NOT NULL,
	[IdUsuario] [varchar](50) NOT NULL,
	[Descripcion] [varchar](250) NOT NULL,
	[Pais] [varchar](50) NOT NULL,
	[Provincia] [varchar](50) NOT NULL,
	[Localidad] [varchar](50) NOT NULL,
	[Direccion] [varchar](60) NOT NULL,
	[CodPost] [varchar](10) NOT NULL,
	[NombreContacto] [varchar](25) NOT NULL,
	[EmailContacto] [varchar](60) NOT NULL,
	[TelefonoContacto] [varchar](50) NOT NULL,
	[Comentarios] [varchar](250) NOT NULL,
	[GoogleMap] [varchar](100) NOT NULL,
	[IdWF] [int] NOT NULL,
	[Estado] [varchar](15) NOT NULL,
	[Ranking] [int] NOT NULL,
	[UltActualiz] [timestamp] NOT NULL,
	[TipoDestacado] varchar(2) NOT NULL,
 CONSTRAINT [PK_Table_Housing] PRIMARY KEY CLUSTERED 
(
	[IdHousing] ASC
)WITH (PAD_INDEX  = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO

insert Configuracion values ('', 'OperHousing', 'UltimoIdHousing', '0')
go

insert TipoPermiso values ('OperHousing', 'Operator Housing')
go

declare @idWF varchar(256)
update Configuracion set @idWF=Valor=convert(varchar(256), convert(int, Valor)+1) where IdItemConfig='UltimoIdWF'
insert Permiso values ('administrador', 'OperHousing', '20621231', @idWF, 'Active')
insert Log values (@IdWF, getdate(), 'administrador', 'Permiso', 'New', 'Active', 'New Script')


alter table Housing add Neighborhood varchar(50) not null default ''
alter table Housing add ApproximateAddress varchar(60) not null default ''
alter table Housing add SizeSgm int not null default ''
alter table Housing add TypePlace varchar(50) not null default ''
alter table Housing add TypeRoom varchar(50) not null default ''
alter table Housing add TypeBathroom varchar(50) not null default ''
alter table Housing add HousingOffer varchar(50) not null default ''
alter table Housing add SkypeAddress varchar(100) not null default ''
alter table Housing add Moneda varchar(10) not null default ''
alter table Housing add PricePerDay [numeric](18, 2) NULL
alter table Housing add PricePerMonth [numeric](18, 2) NULL
alter table Housing add PriceComment varchar(250) not null default ''
alter table Housing add Servicios varchar(500) not null default ''


CREATE TABLE [dbo].[Alojamiento](
	[IdAlojamiento] [int] NOT NULL,
	[IdUsuario] [varchar](50) NOT NULL,
	[Descripcion] [varchar](250) NOT NULL,
	[Pais] [varchar](50) NOT NULL,
	[Provincia] [varchar](50) NOT NULL,
	[Localidad] [varchar](50) NOT NULL,
	[Direccion] [varchar](60) NOT NULL,
	[CodPost] [varchar](10) NOT NULL,
	[NombreContacto] [varchar](25) NOT NULL,
	[EmailContacto] [varchar](60) NOT NULL,
	[TelefonoContacto] [varchar](50) NOT NULL,
	[Comentarios] [varchar](250) NOT NULL,
	[GoogleMap] [varchar](100) NOT NULL,
	[IdWF] [int] NOT NULL,
	[Estado] [varchar](15) NOT NULL,
	[Ranking] [int] NOT NULL,
	[UltActualiz] [timestamp] NOT NULL,
	[TipoDestacado] varchar(2) NOT NULL,
 CONSTRAINT [PK_Table_Alojamiento] PRIMARY KEY CLUSTERED 
(
	[IdAlojamiento] ASC
)WITH (PAD_INDEX  = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO

insert Configuracion values ('', 'OperAlojamiento', 'UltimoAlojamiento', '0')
go

insert TipoPermiso values ('OperAlojamiento', 'Operator Alojamiento')
go

declare @idWF varchar(256)
update Configuracion set @idWF=Valor=convert(varchar(256), convert(int, Valor)+1) where IdItemConfig='UltimoIdWF'
insert Permiso values ('administrador', 'OperAlojamiento', '20621231', @idWF, 'Active')
insert Log values (@IdWF, getdate(), 'administrador', 'Permiso', 'New', 'Active', 'New Script')

alter table Alojamiento add Neighborhood varchar(50) not null default ''
alter table Alojamiento add ApproximateAddress varchar(60) not null default ''
alter table Alojamiento add SizeSgm int not null default ''
alter table Alojamiento add TypePlace varchar(50) not null default ''
alter table Alojamiento add TypeRoom varchar(50) not null default ''
alter table Alojamiento add TypeBathroom varchar(50) not null default ''
alter table Alojamiento add AlojamientoOffer varchar(50) not null default ''
alter table Alojamiento add SkypeAddress varchar(100) not null default ''
alter table Alojamiento add Moneda varchar(10) not null default ''
alter table Alojamiento add PricePerDay [numeric](18, 2) NULL
alter table Alojamiento add PricePerMonth [numeric](18, 2) NULL
alter table Alojamiento add PriceComment varchar(250) not null default ''
alter table Alojamiento add Servicios varchar(500) not null default ''